﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace BanHangCshap.Class.gkhtdl63.BLL
{
    public class Phieuthu2BLL : DAL.Phieuthu2DAL
    {
        public string PhieuThu2_TaomaNgay(DateTime xlPMa, bool xlLoai, string xlH)
        {
            string Ma = "";
            DataTable xlDT = base.Phieuthu2_Taomao(xlH + String.Format("{0:0#}{1:0#}{2:0#}", xlPMa.Year, xlPMa.Month, xlPMa.Day), xlLoai);
            if (xlDT != null)
            {
                if (xlDT.Rows.Count > 0)
                {
                    string[] x = xlDT.Rows[0]["Ma"].ToString().Split('-');
                    Ma = x[1].ToString();
                    var xxx = Convert.ToInt32(Ma);
                    xxx++;
                    return String.Format("{0}{1}{2:0#}{3:0#}-{4:00#}", xlH, xlPMa.Year, xlPMa.Month, xlPMa.Day, xxx);
                }
                else
                    return String.Format("{0}{1}{2:0#}{3:0#}-{4:00#}", xlH, xlPMa.Year, xlPMa.Month, xlPMa.Day, 1);
            }
            else return Ma;
        }

    }
}
